package com.kalvan.client.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 开放API接口标准请求报文结构
 *
 * @author chenliang
 */
@Setter
@Getter
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ApiRequest<T> implements java.io.Serializable {
    static final long serialVersionUID = 1L;
    /**
     * 接入的appId
     */
    @NotBlank(message = "appId不能为空")
    public String appId;
    /**
     * 请求业务数据json对象
     * 请求时需要加密为字符串
     */
    @Valid
    @NotNull(message = "data不能为空")
    public T data;
    /**
     * 使用公钥加密过的AES key
     */
    @JSONField(serialize = false)
    public String key;
    /**
     * 请求签名
     */
    @JSONField(serialize = false)
    public String sign;
}
